const origin = 'http://59.36.87.106:9080';

module.exports = {
    publicPath: '/mallApp',
    devServer: {
        port: 3333,
        proxy: {
            '/api': {
                target: origin + '/iot_market',
                ws: true,
                logLevel: 'debug',
                changeOrigin: true
            },
            '/user/login': {
                target: origin + '/iot_login',
                ws: true,
                logLevel: 'debug',
                changeOrigin: true
            },
            '/code': {
                target: origin + '/iot_user',
                ws: true,
                logLevel: 'debug',
                changeOrigin: true
            },
            // '/user': {
            //     target: origin + '/iot_user',
            //     ws: true,
            //     logLevel: 'debug',
            //     changeOrigin: true
            // },
            '/market': {
                target: origin + '/iot_market',
                ws: true,
                logLevel: 'debug',
                changeOrigin: true
            },
            '/device': {
                target: origin + '/iot_device',
                ws: true,
                logLevel: 'debug',
                changeOrigin: true
            }
        }
    },
    productionSourceMap: false,
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            // 清空console
            config.optimization.minimizer[0].options.terserOptions.compress.warnings = false;
            config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true;
            config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true;
            config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log'];
        }
    }
};